//https://leetcode.cn/problems/linked-list-cycle/submissions/540263950/

bool hasCycle(struct ListNode* head) {

    struct ListNode* slow, * fast;
    slow = fast = head;

    while (fast && fast->next)
    {
        slow = slow->next;
        fast = fast->next->next;

        if (slow == fast)
        {
            return true;
        }

    }

    return false;

}